#调用系统的tracert进行追踪
import os

f = open("./result/ip_6_useful.txt",'r')
i = 1
old_domain = ''
while True:
    read_str = f.readline().replace('\n','')
    if len(read_str)==0:
        break
    else:
        start = read_str.find(',')
        domain = read_str[:start]
        ip = read_str[start+1:]
        if domain == old_domain: #一个域名对应多个IP时
            os.system('tracert -d -h 20 '+ip+' >E:/JupyterTemp/'+domain+str(i))
            i = i+1
        else:
            os.system('tracert -d -h 20 '+ip+' >E:/JupyterTemp/'+domain)
            old_domain = domain
            i = 1

f.close()